import pymysql

conn = None


def init_db():
    conn = pymysql.connect(
        host='localhost',
        user='root', password='', database='db_0',
        charset='utf8')
    cursor = conn.cursor()
    return cursor

def query(sql, params):
   cursor = init_db()
   cursor.execute(sql, params)
   results = cursor.fetchall()
   for row in results:
       print(row[0])
       print(row[1])
       print(row[2])


if __name__ == '__main__':
    sql = "select * from novel"
    params = {}
    query(sql, params)